/**
  \file Background.qml
\brief Background definition (semitransparent)

The background is built using a small png pattern, tiled on all the viewer area.
This file is part of "Black Cat Cutting Studio".

\author © 2011 Enrico Miglino / Tech Consulting (enrico.miglino@ovi.com)
\author "Black Cat Cutting Studio" is protected by the copyright law
\author Distributed under the LGPL 3.0 license.
\version 1.0 alpha
\date 2011

\par Black Cat Cutting Studio licensing notes

    "Black Cat Cutting Studio" is free software: you can redistribute it
    and/or modify it under the terms of the Lesser GNU General Public License
    as published by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    "Black Cat Cutting Studio" is distributed in the hope that it
    will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    Lesser GNU General Public License for more details.

    You should have received a copy of the Lesser GNU General Public License
    along with "Black Cat Cutting Studio".
    If not, see <http://www.gnu.org/licenses/>.

*/
import QtQuick 1.0

/*!
Item definition for the background structure
The image is tiled over all the viewer area.
*/
Item {
    id: background

    /*
      Logo image is set to maintain proprortions, so the proportional resizing
      for the adaptive interface need only one of the two sizes. The choice of
      width is arbitrary.
    */
    property alias logoSize: logo.width
    /*
      Shadow border on top of the viewer area. Height and width depends by the screen
      size and the height of the top elements
    */
    property alias shadowWidth: topShadow.width
    property alias shadowHeight: topShadow.height

    // Background is sized to the viewer dimensions
    width: parent.width
    height: parent.height

    // Gradient rectangle to fix the background tiled colors
    Rectangle {
        id: backRect

        width: parent.width
        height: parent.height
        color: "#ffffff"
        gradient: Gradient {
            GradientStop {
                position: 0.00;
                color: "#ffffff";
            }
            GradientStop {
                position: 1.00;
                color: "#d8eef5";
            }
        }
    }

    // Tiled image to fill the viewer area
    Image {
        id: tiledGraphics

        width: parent.width
        height: parent.height
        // fillMode is set to tiled, to repeat on all the filled area.
        fillMode: Image.Tile
        // The image source file (base element to tile)
        source: "../images/background.svg"
    }

    // Top border with the text area and toolbar buttons
    Image {
        id: topShadow

        opacity: 0.2
        source: "../images/TopShadowed.png"
    }

    // Top-left logo. The size of the logo depends on the top horizontal button toolbar
    Image {
        id: logo

        // Set the scaling mode.
        fillMode: Image.PreserveAspectFit
        source: "../images/LogoIcon.png"
        anchors.left: parent.left
        anchors.top: parent.top
    }

}
